<template>
  <div class=''>
    <el-button @click="excelExport">导出</el-button>
  </div>
</template>

<script>
import API from '@/api/requestMethods'
import { download } from '@/utils'
export default {
  name: 'easypoiExport',
  data () {
    return {

    }
  },
  methods: {
    excelExport () {
      API.excelExport('test').then(res => {
        let fileName = decodeURI(res.headers['content-disposition'].split(';')[1].split('=')[1])
        download(res.data, fileName)
      }).catch(e => {
        this.$message.error(`error:${e.message}`)
      })
    }
  }
}
</script>
